import { _decorator, Component, IVec2, Node } from 'cc';
import { EntityTypeEnum } from '../../Common';
import { ExplosionStateMachine } from './ExplosionStateMachine';
import { EntityManager } from '../../Base/EntityManager';
import { EntityStateEnum, EventEnum } from '../../Enum';
import EventManager from '../../Global/EventManager';
const { ccclass, property } = _decorator;

@ccclass('ExplosionManager')
export class ExplosionManager extends EntityManager {
    type:EntityTypeEnum
    id:number
    init(type:EntityTypeEnum,{x,y}:IVec2){
        this.node.setPosition(x,y)
        this.type=type
        
        //每次init的时候都会挂载脚本，所以在对象池调用时要判断有没有这个组件，有就不add了
        this.fsm=this.getComponent(ExplosionStateMachine)||this.addComponent(ExplosionStateMachine)
        this.fsm.init(type)

        //设置默认状态，并且执行其动画
        this.state=EntityStateEnum.Idle

    }
}

